package pl.edu.pw.polygen.menu.commands;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import pl.edu.pw.polygen.ui.help.HelpWindow;
import pl.edu.pw.polygen.util.ApplicationHolder;

import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;

@Component
public class HelpCommand implements Command {
	
	private static final long serialVersionUID = 7875336550119938214L;

	@Autowired
	private HelpWindow helpWindow;
	
	@Override
	public void menuSelected(MenuItem selectedItem) {
		System.out.println(selectedItem.getText());
		 if (helpWindow.getParent() == null) {
			 ApplicationHolder.getApplication().getMainWindow().addWindow(helpWindow);
		 }
	}

}
